---
title: Spec - howl.interact
tags: spec
---
<div class="spec-group spec-group-1">

<h1 id="howl.interact">howl.interact</h1>

<pre class="highlight moonscript"><code><span class="n">run_in_coroutine</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">f</span><span class="p">)</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">
  </span><span class="n">wrapped</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">coroutine.wrap</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">f</span><span class="o">!</span><span class="w">
  </span><span class="k">return</span><span class="w"> </span><span class="n">wrapped</span><span class="o">!</span><span class="w">

</span><span class="n">before_each</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">
  </span><span class="k">if</span><span class="w"> </span><span class="n">howl</span><span class="p">.</span><span class="n">app</span><span class="p">.</span><span class="n">window</span><span class="w">
    </span><span class="n">howl</span><span class="p">.</span><span class="n">app</span><span class="p">.</span><span class="n">window</span><span class="p">.</span><span class="n">command_line</span><span class="o">\</span><span class="n">abort_all</span><span class="o">!</span><span class="w">
  </span><span class="n">howl</span><span class="p">.</span><span class="n">app</span><span class="p">.</span><span class="n">window</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Window</span><span class="o">!</span><span class="w">

</span><span class="n">after_each</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">
  </span><span class="n">howl</span><span class="p">.</span><span class="n">app</span><span class="p">.</span><span class="n">window</span><span class="p">.</span><span class="n">command_line</span><span class="o">\</span><span class="n">abort_all</span><span class="o">!</span><span class="w">
  </span><span class="n">howl</span><span class="p">.</span><span class="n">app</span><span class="p">.</span><span class="n">window</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">nil</span></code></pre>


<h4 id=".unregister(name)-removes-the-specified-input">.unregister(name) removes the specified input</h4>

<pre class="highlight moonscript"><code><span class="n">interact</span><span class="p">.</span><span class="n">register</span><span class="w"> </span><span class="ss">name:</span><span class="w"> </span><span class="s1">'foo'</span><span class="p">,</span><span class="w"> </span><span class="ss">description:</span><span class="w"> </span><span class="s1">'foo'</span><span class="p">,</span><span class="w"> </span><span class="ss">factory:</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="kc">true</span><span class="w">
</span><span class="n">interact</span><span class="p">.</span><span class="n">unregister</span><span class="w"> </span><span class="s1">'foo'</span><span class="w">
</span><span class="n">assert</span><span class="p">.</span><span class="n">is_nil</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">foo</span></code></pre>

<div class="spec-group spec-group-2">

<h2 id=".register(spec)">.register(spec)</h2>

<h4 id="raises-an-error-if-any-of-the-mandatory-fields-are-missing">raises an error if any of the mandatory fields are missing</h4>

<pre class="highlight moonscript"><code><span class="n">assert</span><span class="p">.</span><span class="n">raises</span><span class="w"> </span><span class="s1">'name'</span><span class="p">,</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">register</span><span class="w"> </span><span class="ss">description:</span><span class="w"> </span><span class="s1">'foo'</span><span class="p">,</span><span class="w"> </span><span class="ss">factory:</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="kc">true</span><span class="w">
</span><span class="n">assert</span><span class="p">.</span><span class="n">raises</span><span class="w"> </span><span class="s1">'description'</span><span class="p">,</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">register</span><span class="w"> </span><span class="ss">name:</span><span class="w"> </span><span class="s1">'foo'</span><span class="p">,</span><span class="w"> </span><span class="ss">factory:</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="kc">true</span><span class="w">
</span><span class="n">assert</span><span class="p">.</span><span class="n">raises</span><span class="w"> </span><span class="s1">'factory'</span><span class="p">,</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">register</span><span class="w"> </span><span class="ss">name:</span><span class="w"> </span><span class="s1">'foo'</span><span class="p">,</span><span class="w"> </span><span class="ss">description:</span><span class="w"> </span><span class="s1">'foo'</span></code></pre>


<h4 id="accepts-one-of-&quot;factory&quot;-or-&quot;handler&quot;">accepts one of &quot;factory&quot; or &quot;handler&quot;</h4>

<pre class="highlight moonscript"><code><span class="n">assert</span><span class="p">.</span><span class="n">raises</span><span class="w"> </span><span class="s1">'factory'</span><span class="p">,</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">register</span><span class="w">
  </span><span class="ss">name:</span><span class="w"> </span><span class="s1">'foo'</span><span class="w">
  </span><span class="ss">description:</span><span class="w"> </span><span class="s1">'foo'</span><span class="w">
  </span><span class="ss">factory:</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="kc">true</span><span class="w">
  </span><span class="ss">handler:</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="kc">true</span></code></pre>

</div>
<div class="spec-group spec-group-2">

<h3 id="(calling-an-interaction-.&lt;name&gt;(...))">(calling an interaction .&lt;name&gt;(...))</h3>

<pre class="highlight moonscript"><code><span class="n">before_each</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">
  </span><span class="n">interact</span><span class="p">.</span><span class="n">register</span><span class="w">
    </span><span class="ss">name:</span><span class="w"> </span><span class="s1">'interaction_call'</span><span class="w">
    </span><span class="ss">description:</span><span class="w"> </span><span class="s1">'calls passed in function'</span><span class="w">
    </span><span class="ss">handler:</span><span class="w"> </span><span class="p">(</span><span class="n">f</span><span class="p">)</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">f</span><span class="o">!</span><span class="w">

  </span><span class="n">interaction_instance</span><span class="w"> </span><span class="o">=</span><span class="w">
    </span><span class="ss">run:</span><span class="w"> </span><span class="p">(</span><span class="vi">@finish</span><span class="p">,</span><span class="w"> </span><span class="n">f</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">f</span><span class="p">(</span><span class="n">finish</span><span class="p">)</span><span class="w">

  </span><span class="n">interact</span><span class="p">.</span><span class="n">register</span><span class="w">
    </span><span class="ss">name:</span><span class="w"> </span><span class="s1">'interaction_with_factory'</span><span class="p">,</span><span class="w">
    </span><span class="ss">description:</span><span class="w"> </span><span class="s1">'calls passed in function f(finish)'</span><span class="w">
    </span><span class="ss">factory:</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">moon</span><span class="p">.</span><span class="n">copy</span><span class="w"> </span><span class="n">interaction_instance</span><span class="w">

</span><span class="n">after_each</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">
  </span><span class="n">interact</span><span class="p">.</span><span class="n">unregister</span><span class="w"> </span><span class="s1">'interaction_call'</span><span class="w">
  </span><span class="n">interact</span><span class="p">.</span><span class="n">unregister</span><span class="w"> </span><span class="s1">'interaction_with_factory'</span></code></pre>

<div class="spec-group spec-group-3">

<h3 id="(..--for-a-spec-with-.handler)">(..  for a spec with .handler)</h3>

<pre class="highlight moonscript"><code><span class="kd">local</span><span class="w"> </span><span class="n">i1_spec</span><span class="w">
</span><span class="n">before_each</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">
  </span><span class="n">i1_spec</span><span class="w"> </span><span class="o">=</span><span class="w">
    </span><span class="ss">name:</span><span class="w"> </span><span class="s1">'interaction1'</span><span class="w">
    </span><span class="ss">description:</span><span class="w"> </span><span class="s1">'interaction with handler'</span><span class="w">
    </span><span class="ss">handler:</span><span class="w"> </span><span class="n">spy</span><span class="p">.</span><span class="n">new</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="s1">'r1'</span><span class="p">,</span><span class="w"> </span><span class="s1">'r2'</span><span class="w">
  </span><span class="n">interact</span><span class="p">.</span><span class="n">register</span><span class="w"> </span><span class="n">i1_spec</span><span class="w">

</span><span class="n">after_each</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">
  </span><span class="n">interact</span><span class="p">.</span><span class="n">unregister</span><span class="w"> </span><span class="n">i1_spec</span><span class="p">.</span><span class="n">name</span></code></pre>


<h4 id="calls-the-interaction-handler(...),-returns-result">calls the interaction handler(...), returns result</h4>

<pre class="highlight moonscript"><code><span class="n">multi_value</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">table.pack</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">interaction1</span><span class="w"> </span><span class="s1">'arg1'</span><span class="p">,</span><span class="w"> </span><span class="s1">'arg2'</span><span class="w">
</span><span class="n">assert</span><span class="p">.</span><span class="n">spy</span><span class="p">(</span><span class="n">i1_spec</span><span class="p">.</span><span class="n">handler</span><span class="p">).</span><span class="n">was_called_with</span><span class="w"> </span><span class="s1">'arg1'</span><span class="p">,</span><span class="w"> </span><span class="s1">'arg2'</span><span class="w">
</span><span class="n">assert</span><span class="p">.</span><span class="n">is_same</span><span class="w"> </span><span class="p">{</span><span class="s1">'r1'</span><span class="p">,</span><span class="w"> </span><span class="s1">'r2'</span><span class="p">,</span><span class="w"> </span><span class="ss">n:</span><span class="mi">2</span><span class="p">},</span><span class="w"> </span><span class="n">multi_value</span></code></pre>

</div>
<div class="spec-group spec-group-3">

<h3 id="(..--for-a-spec-with-.factory)">(..  for a spec with .factory)</h3>

<pre class="highlight moonscript"><code><span class="kd">local</span><span class="w"> </span><span class="n">i2_spec</span><span class="p">,</span><span class="w"> </span><span class="n">i2_interactor</span><span class="w">
</span><span class="n">before_each</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">
  </span><span class="n">i2_interactor</span><span class="w"> </span><span class="o">=</span><span class="w">
    </span><span class="ss">run:</span><span class="w"> </span><span class="n">spy</span><span class="p">.</span><span class="n">new</span><span class="w"> </span><span class="p">(</span><span class="vi">@finish</span><span class="p">,</span><span class="w"> </span><span class="o">...</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="k">return</span><span class="w">
  </span><span class="n">i2_spec</span><span class="w"> </span><span class="o">=</span><span class="w">
    </span><span class="ss">name:</span><span class="w"> </span><span class="s1">'interaction2'</span><span class="w">
    </span><span class="ss">description:</span><span class="w"> </span><span class="s1">'interaction with factory'</span><span class="w">
    </span><span class="ss">factory:</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">i2_interactor</span><span class="w">
  </span><span class="n">interact</span><span class="p">.</span><span class="n">register</span><span class="w"> </span><span class="n">i2_spec</span><span class="w">

</span><span class="n">after_each</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">
  </span><span class="n">interact</span><span class="p">.</span><span class="n">unregister</span><span class="w"> </span><span class="n">i2_spec</span><span class="p">.</span><span class="n">name</span></code></pre>


<h4 id=".&lt;name&gt;(...)-invokes-the-interaction-method-run(finish,-...)">.&lt;name&gt;(...) invokes the interaction method run(finish, ...)</h4>

<pre class="highlight moonscript"><code><span class="n">run_in_coroutine</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="nb">table.pack</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">interaction2</span><span class="w"> </span><span class="s1">'arg1'</span><span class="p">,</span><span class="w"> </span><span class="s1">'arg2'</span><span class="w">
</span><span class="n">assert</span><span class="p">.</span><span class="n">spy</span><span class="p">(</span><span class="n">i2_interactor</span><span class="p">.</span><span class="n">run</span><span class="p">).</span><span class="n">was_called</span><span class="w"> </span><span class="mi">1</span></code></pre>


<h4 id=".&lt;name&gt;(...)-returns-results-passed-via-finish(...)">.&lt;name&gt;(...) returns results passed via finish(...)</h4>

<pre class="highlight moonscript"><code><span class="n">multi_value</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">nil</span><span class="w">
</span><span class="n">run_in_coroutine</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">multi_value</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">table.pack</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">interaction2</span><span class="o">!</span><span class="w">
</span><span class="n">i2_interactor</span><span class="p">.</span><span class="n">finish</span><span class="w"> </span><span class="s1">'r1'</span><span class="p">,</span><span class="w"> </span><span class="s1">'r2'</span><span class="w">
</span><span class="n">assert</span><span class="p">.</span><span class="n">is_same</span><span class="w"> </span><span class="p">{</span><span class="s1">'r1'</span><span class="p">,</span><span class="w"> </span><span class="s1">'r2'</span><span class="p">,</span><span class="w"> </span><span class="ss">n:</span><span class="mi">2</span><span class="p">},</span><span class="w"> </span><span class="n">multi_value</span></code></pre>

</div>
<div class="spec-group spec-group-3">

<h3 id="(..--nested-transactions)">(..  nested transactions)</h3>

<h4 id="raises-an-error-when-attempting-to-finishing-not-active-interaction">raises an error when attempting to finishing not active interaction</h4>

<pre class="highlight moonscript"><code><span class="kd">local</span><span class="w"> </span><span class="n">captured_finish</span><span class="w">
</span><span class="n">capture_finish</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">finish</span><span class="p">)</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">captured_finish</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">finish</span><span class="w">

</span><span class="n">run_in_coroutine</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">interaction_with_factory</span><span class="w"> </span><span class="n">capture_finish</span><span class="w">
</span><span class="n">finish1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">captured_finish</span><span class="w">
</span><span class="n">finish1</span><span class="o">!</span><span class="w">

</span><span class="n">assert</span><span class="p">.</span><span class="n">has_error</span><span class="w"> </span><span class="n">finish1</span><span class="p">,</span><span class="w"> </span><span class="s1">'Cannot finish - no running activities'</span></code></pre>


<h4 id="allows-cancelling-outer-interactions,-when-nested-interactions-present">allows cancelling outer interactions, when nested interactions present</h4>

<pre class="highlight moonscript"><code><span class="kd">local</span><span class="w"> </span><span class="n">captured_finish</span><span class="w">
</span><span class="n">capture_finish</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">finish</span><span class="p">)</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">captured_finish</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">finish</span><span class="w">

</span><span class="n">run_in_coroutine</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">interaction_with_factory</span><span class="w"> </span><span class="n">capture_finish</span><span class="w">
</span><span class="n">run_in_coroutine</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">interaction_with_factory</span><span class="w"> </span><span class="n">capture_finish</span><span class="w">
</span><span class="n">finish2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">captured_finish</span><span class="w">

</span><span class="n">assert</span><span class="p">.</span><span class="n">has_no_error</span><span class="w"> </span><span class="n">finish2</span></code></pre>

</div>
</div>
<div class="spec-group spec-group-2">

<h2 id="sequence()">sequence()</h2>

<h4 id="runs-specified-functions-in-serial,-returns-table-containing-all-results">runs specified functions in serial, returns table containing all results</h4>

<pre class="highlight moonscript"><code><span class="n">calls</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{}</span><span class="w">
</span><span class="kd">local</span><span class="w"> </span><span class="n">result</span><span class="w">
</span><span class="n">run_in_coroutine</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">
  </span><span class="n">result</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">sequence</span><span class="w"> </span><span class="p">{</span><span class="s1">'first'</span><span class="p">,</span><span class="w"> </span><span class="s1">'second'</span><span class="p">,</span><span class="w"> </span><span class="s1">'third'</span><span class="p">},</span><span class="w">
    </span><span class="ss">first:</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">
      </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">calls</span><span class="p">,</span><span class="w"> </span><span class="s1">'first'</span><span class="w">
      </span><span class="s1">'first-result'</span><span class="w">
    </span><span class="ss">second:</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">
      </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">calls</span><span class="p">,</span><span class="w"> </span><span class="s1">'second'</span><span class="w">
      </span><span class="s1">'second-result'</span><span class="w">
    </span><span class="ss">third:</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">
      </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">calls</span><span class="p">,</span><span class="w"> </span><span class="s1">'third'</span><span class="w">
      </span><span class="s1">'third-result'</span><span class="w">
</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="p">{</span><span class="s1">'first'</span><span class="p">,</span><span class="w"> </span><span class="s1">'second'</span><span class="p">,</span><span class="w"> </span><span class="s1">'third'</span><span class="p">},</span><span class="w"> </span><span class="n">calls</span><span class="w">
</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="s1">'first-result'</span><span class="p">,</span><span class="w"> </span><span class="n">result</span><span class="p">.</span><span class="n">first</span><span class="w">
</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="s1">'second-result'</span><span class="p">,</span><span class="w"> </span><span class="n">result</span><span class="p">.</span><span class="n">second</span><span class="w">
</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="s1">'third-result'</span><span class="p">,</span><span class="w"> </span><span class="n">result</span><span class="p">.</span><span class="n">third</span></code></pre>


<h4 id="a-function-returning-nil-cancels-the-entire-interaction">a function returning nil cancels the entire interaction</h4>

<pre class="highlight moonscript"><code><span class="n">calls</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{}</span><span class="w">
</span><span class="kd">local</span><span class="w"> </span><span class="n">result</span><span class="w">
</span><span class="n">run_in_coroutine</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">
  </span><span class="n">result</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">sequence</span><span class="w"> </span><span class="p">{</span><span class="s1">'first'</span><span class="p">,</span><span class="w"> </span><span class="s1">'second'</span><span class="p">,</span><span class="w"> </span><span class="s1">'third'</span><span class="p">},</span><span class="w">
    </span><span class="ss">first:</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">
      </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">calls</span><span class="p">,</span><span class="w"> </span><span class="s1">'first'</span><span class="w">
      </span><span class="s1">'first-result'</span><span class="w">
    </span><span class="ss">second:</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">
      </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">calls</span><span class="p">,</span><span class="w"> </span><span class="s1">'second'</span><span class="w">
      </span><span class="kc">nil</span><span class="w">
    </span><span class="ss">third:</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">
      </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">calls</span><span class="p">,</span><span class="w"> </span><span class="s1">'third'</span><span class="w">
      </span><span class="s1">'third-result'</span><span class="w">
</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="p">{</span><span class="s1">'first'</span><span class="p">,</span><span class="w"> </span><span class="s1">'second'</span><span class="p">},</span><span class="w"> </span><span class="n">calls</span><span class="w">
</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="kc">nil</span><span class="p">,</span><span class="w"> </span><span class="n">result</span></code></pre>


<h4 id="calls-`finish`,-if-present,-on-the-final-result-and-returns-that">calls `finish`, if present, on the final result and returns that</h4>

<pre class="highlight moonscript"><code><span class="kd">local</span><span class="w"> </span><span class="n">result</span><span class="w">
</span><span class="n">run_in_coroutine</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">
  </span><span class="n">result</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">sequence</span><span class="w"> </span><span class="p">{</span><span class="s1">'first'</span><span class="p">},</span><span class="w">
    </span><span class="ss">first:</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="s1">'first-result'</span><span class="w">
    </span><span class="ss">finish:</span><span class="w"> </span><span class="p">(</span><span class="n">r</span><span class="p">)</span><span class="w"> </span><span class="o">-&gt;</span><span class="w"> </span><span class="s1">'finish '</span><span class="w"> </span><span class="o">..</span><span class="w"> </span><span class="n">r</span><span class="p">.</span><span class="n">first</span><span class="w">
</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="s1">'finish first-result'</span><span class="p">,</span><span class="w"> </span><span class="n">result</span></code></pre>

</div>
</div>
